{% extends 'shop/base.html' %}

{% block content %}
<div class="container">
    <h2 class="my-4">订单详情</h2>
    <div class="card mb-4">
        <div class="card-header">
            <h5>订单号: {{ order.order_no }}</h5>
        </div>
        <div class="card-body">
            <p>状态: {{ order.get_status_display }}</p>
            <p>创建时间: {{ order.created_at }}</p>
            <p>总金额: ¥{{ order.get_total_cost }}</p>
        </div>
    </div>

    <h4 class="my-4">商品列表</h4>
    <table class="table table-striped">
        <thead>
            <tr>
                <th>商品</th>
                <th>单价</th>
                <th>数量</th>
                <th>小计</th>
            </tr>
        </thead>
        <tbody>
            {% for item in order.items.all %}
            <tr>
                <td>{{ item.product.name }}</td>
                <td>¥{{ item.price }}</td>
                <td>{{ item.quantity }}</td>
                <td>¥{{ item.get_cost }}</td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %}